﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Process.BLL;
using Process.Entities;
using System.Data;

namespace Business
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadListProduct();
            }




        }
        void LoadListProduct()
        {
            if (!IsPostBack)
            {
                DataList1.DataSource = ProductBLL.GetProductList(6);
                DataList1.DataBind();
            }
        }

        protected void ImageButton1_Command(object sender, CommandEventArgs e)
        {
            string productID = e.CommandName;
            CartBLL cart = (CartBLL)Session["cart"];
            if (cart == null)
            {
                cart = new CartBLL();
            }

            //cart.CreateTempCart(productID, 1);
            ProductENT product = ProductBLL.GetProductByID(productID);
            //cart.CreateTempCart(productID, 1, product.ProductName, product.UnitPrice);
            Session.Add("cart", cart);
        }


    }
}